home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / rkplus20.zip / RKPGKEY.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-08  |  3KB  |  103 lines

  1. Program RkpGKey;
  2.  
  3. {
  4.  This is a sample program using rkPlus.  It is a sample of a registration
  5.  key generation program that would be used by the programmer to create
  6.  registration keys to be distributed to registered users.  The user would
  7.  then enter the registration key into a "branding" program (such as RkpBrand)
  8.  to create the key file. The key generation program itself would NOT be
  9.  distributed, as it would allow users to generate keys.  This sample can
  10.  create a 1 or 2 month limited use demo key, a 1 year registration key
  11.  or an unlimited registration key, for the RkpDemo program.
  12. }
  13.  
  14.  
  15. Uses
  16.   Crt, Dos, RkPlus;
  17.  
  18.  
  19. Const
  20.   RkpGKeyVer = '2.1';
  21.   MonthNames : Array[1..12] of String[3]
  22.   = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
  23.  
  24.  
  25. Var
  26.   kc          : Char;
  27.   ey,em,dd,dw : Word;
  28.  
  29.  
  30. Begin
  31.   OwnerCode := 'ArgleBarbWotsLeeb';
  32.   ProgramCode := 'RkpDemo Three';
  33.   KeyFile := 'RKPDEMO';
  34.   WriteLn('RkpGKey ' + RkpGKeyVer);
  35.   WriteLn('Registration Key Generation Program for RkpDemo 3.x');
  36.   WriteLn('(c) 1991 TrendSoft, Inc.');
  37.   WriteLn;
  38.   WriteLn('FOR INTERNAL USE ONLY!');
  39.   WriteLn('DO NOT DISTRIBUTE!');
  40.   WriteLn;
  41.   Write('Enter name of person to register : ');
  42.   ReadLn(Reg.Name1);
  43.   WriteLn;
  44.   WriteLn('[1] 1 month limited use demo key');
  45.   WriteLn('[2] 2 month limited use demo key');
  46.   WriteLn('[R] registration key (1 year)');
  47.   WriteLn('[U] unlimited registration key');
  48.   WriteLn;
  49.   Write('Type? ');
  50.   kc := UpCase(ReadKey);
  51.   WriteLn(kc);
  52.   WriteLn;
  53.   GetDate(ey,em,dd,dw);
  54.   If (kc = '1') then Begin
  55.     If (em = 12) then Begin
  56.       em := 1;
  57.       Inc(ey);
  58.     End Else
  59.       Inc(em);
  60.     WriteLn('Creating limited use demo key (will expire 1-',MonthNames[em],'-',ey,')');
  61.     Reg.Level := 0;
  62.     Reg.ExpYear := ey;
  63.     Reg.ExpMonth := em;
  64.   End Else If (kc = '2') then Begin
  65.     If (em = 11) then Begin
  66.       em := 1;
  67.       Inc(ey);
  68.     End Else If (em = 12) then Begin
  69.       em := 2;
  70.       Inc(ey);
  71.     End Else Begin
  72.       Inc(em,2);
  73.     End;
  74.     WriteLn('Creating limited use demo key (will expire 1-',MonthNames[em],'-',ey,')');
  75.     Reg.Level := 0;
  76.     Reg.ExpYear := ey;
  77.     Reg.ExpMonth := em;
  78.   End Else If (kc in ['R','r']) then Begin
  79.     If (em = 12) then Begin
  80.       em := 1;
  81.       Inc(ey);
  82.     End Else
  83.       Inc(em);
  84.     Inc(ey);
  85.     WriteLn('Creating registration key (will expire 1-',MonthNames[em],'-',ey,')');
  86.     Reg.Level := 1;
  87.     Reg.ExpYear := ey;
  88.     Reg.ExpMonth := em;
  89.   End Else Begin
  90.     WriteLn('Creating unlimited registration key');
  91.     Reg.Level := 1;
  92.     Reg.ExpYear := 0;
  93.     Reg.ExpMonth := 0;
  94.   End;
  95.   Reg.ID := 'RkpDemo';
  96.   Reg.Message := '(c) 1991 TrendSoft, Inc.';
  97.   Reg.Name2 := '';
  98.   Reg.Name3 := '';
  99.   CreateKey;
  100.   WriteLn;
  101.   WriteLn('Key is ',Reg.Key);
  102. End.
  103.